package com.lee.taste.spider.sohu.xml;

import org.dom4j.Attribute;
import org.dom4j.Element;

public class XMLUtils {
	public static String getAttributeValue(Element root,String nodeName,String attributeName){
		Element element = root.element(nodeName);
        Attribute attribute = element.attribute(attributeName);
        String value = attribute.getText();
        return value;
	}
	public static String getAttributeValue(Element node,String attributeName){
		if(node == null){
			return null;
		}
		Attribute attribute = node.attribute(attributeName);
		if( attribute!=null){
			String value = attribute.getText();
	        return value;
		}
        return null;
	}
}
